//
//  ESTCarBrandModel.m
//  ESTSCRMAPP
//
//  Created by 李贤立 on 2018/10/20.
//  Copyright © 2018年 Capfer. All rights reserved.
//

#import "ESTCarBrandModel.h"

@implementation ESTCarBrandContentModel

@end
@implementation ESTCarBrandSeriesModel

@end
@implementation ESTCarBrandConfigModel

@end

@implementation ESTCarBrandModel

/**
 查询经销店的车辆品牌

 @param DLR_ID 经销商ID
 @param success 成功回调
 @param failure 失败回调
 */
+ (void)enquiriesCarBrandWithDLR_ID:(NSString *)DLR_ID success:(void(^)(NSArray<ESTCarBrandContentModel *> *modelArray))success failure:(void(^)(NSString *error))failure {
    NSString *dlr_id = DLR_ID;
    if (!DLR_ID) {
        dlr_id = @"";
    }
    [NetTool postWithCode:Code_Activity_CarBrand parameter:@{@"DLR_ID" : dlr_id, @"IS_COUNT" : @"1"} success:^(NSDictionary *result) {
        NSArray *arr = [NSArray arrayWithArray:result[@"DATA_INFO"]];
        NSMutableArray *arrayM = [ESTCarBrandContentModel mj_objectArrayWithKeyValuesArray:arr];
        if (success) {
            success([arrayM mutableCopy]);
        }
    } failure:^(NSString *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)enquiriesCarSeriesWithDLR_ID:(NSString *)DLR_ID brand_id:(NSString *)car_brand_id success:(void (^)(NSArray<ESTCarBrandSeriesModel *> *))success failure:(void (^)(NSString *))failure {
    NSString *dlr_id = DLR_ID;
    if (!DLR_ID) {
        dlr_id = @"";
    }
    NSString *brand_id = car_brand_id;
    if (!car_brand_id) {
        brand_id = @"";
    }
    [NetTool postWithCode:Code_Activity_CarSeries parameter:@{
                                                             @"DLR_ID" : dlr_id,
                                                             @"CAR_BRAND_ID" : brand_id,
                                                             @"IS_COUNT" : @"1"
                                                             } success:^(NSDictionary *result) {
        NSArray *arr = [NSArray arrayWithArray:result[@"DATA_INFO"]];
        NSMutableArray *arrayM = [ESTCarBrandSeriesModel mj_objectArrayWithKeyValuesArray:arr];
        if (success) {
            success([arrayM mutableCopy]);
        }
    } failure:^(NSString *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)enquiriesCarConfigWithDLR_ID:(NSString *)DLR_ID brand_id:(NSString *)car_brand_id series_id:(NSString *)car_series_id success:(void (^)(NSArray<ESTCarBrandConfigModel *> *))success failure:(void (^)(NSString *))failure {
    NSString *dlr_id = DLR_ID;
    if (!DLR_ID) {
        dlr_id = @"";
    }
    NSString *brand_id = car_brand_id;
    if (!car_brand_id) {
        brand_id = @"";
    }
    NSString *series_id = car_series_id;
    if (!car_series_id) {
        series_id = @"";
    }
    [NetTool postWithCode:Code_Activity_CarConfig parameter:@{
                                                             @"DLR_ID" : dlr_id,
                                                             @"CAR_BRAND_ID" : brand_id,
                                                             @"CAR_SERIES_ID" : series_id,
                                                             @"IS_COUNT" : @"1"
                                                             } success:^(NSDictionary *result) {
        NSArray *arr = [NSArray arrayWithArray:result[@"DATA_INFO"]];
        NSMutableArray *arrayM = [ESTCarBrandConfigModel mj_objectArrayWithKeyValuesArray:arr];
        if (success) {
            success([arrayM mutableCopy]);
        }
    } failure:^(NSString *error) {
        if (failure) {
            failure(error);
        }
    }];
}
@end
